package com.example.test_witns.ui.register_finished;

import static android.content.ContentValues.TAG;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.example.test_witns.BottomNavigationViewActivity;
import com.example.test_witns.R;
import com.example.test_witns.databinding.ActivityRegisterFinished2Binding;
import com.example.test_witns.utils.MyInfosHelper;

public class RegisterFinishedActivity2 extends Activity {
    ActivityRegisterFinished2Binding binding;
    String uuid;
    String nickname;
    String sig;
    String email;
    String avatarURI;
    byte[] avatarBytes;
    String avatarURL;

    @Nullable
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityRegisterFinished2Binding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());


        View finished_2_complete = findViewById(R.id.finished_2_complete);

        TextView nickname_passed = findViewById(R.id.nickname_passed);
        Intent intent = getIntent();
        if (intent != null){
            nickname = intent.getStringExtra("nickname");
            nickname_passed.setText(nickname);
            uuid = intent.getStringExtra("uuid");
            sig = intent.getStringExtra("sig");
            email = intent.getStringExtra("email");
            avatarURI = intent.getStringExtra("avatar_uri");
            avatarBytes = intent.getByteArrayExtra("avatar");
            avatarURL = intent.getStringExtra("avatar_url");
            Log.d(TAG, "onClick1:" + nickname + uuid + sig + email);
        }
        MyInfosHelper myInfosHelper = new MyInfosHelper(this);
        myInfosHelper.addMyInfos(email, nickname, sig, uuid, avatarBytes, avatarURI, avatarURL);

        View finished_2_skip = findViewById(R.id.finished_2_skip);
        finished_2_skip.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getApplicationContext(), BottomNavigationViewActivity.class);
                startActivity(intent);
            }
        });

        finished_2_complete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getApplicationContext(), BottomNavigationViewActivity.class);
                startActivity(intent);
            }
        });

    }

}
